gridpack::math::VectorT< T, I > Class Template Reference

A parallel or serial vector of values. More...

#include <vector.hpp>

Inheritance diagram for gridpack::math::VectorT< T, I >:
Inheritance graph
[legend]
Collaboration diagram for gridpack::math::VectorT< T, I >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef BaseVectorInterface< T,
I >::IdxType 
IdxType
typedef BaseVectorInterface< T,
I >::TheType 
TheType

Public Member Functions

 VectorT (const parallel::Communicator &comm, const int &local_length)
 Default constructor.
 VectorT (ImplType *vimpl)
 Constuct with an existing implementation.
 ~VectorT (void)
 Destructor.
VectorTclone (void) const
VectorTlocalClone (void) const
 Make a (sequential) copy of a vector local to this processor.
void add (const VectorT &x, const TheType &scale=1.0)
 Add the specified vector.
void add (const TheType &x)
 Add the specified value to all elements.
void equate (const VectorT &x)
 Copy the elements from the specified Vector.
void elementMultiply (const VectorT &x)
 Element-by-element multiply by another Vector.
void elementDivide (const VectorT &x)
 ELement-by-element divide by another Vector.

Detailed Description

template<typename T, typename I = int>
class gridpack::math::VectorT< T, I >

A parallel or serial vector of values.

This class encapsulates a vector of values.

When a VectorT is instantiated it is ready to be filled using calls to methods like setElement(). When the VectorT is filled, all processors must be notified that it is ready to use with a call to ready().

For efficiency, setElement(), and related calls, should only set locally owned elements, even though off processor elements can be set with those methods. getElement(), and related calls, can only access locally owned elements. Off processor values can be obtained by calling get_all_elements() (currently the only way).

Element indexing is always global and 0-based.

This class uses the Pimpl idiom for implementation so the interface is completely free of the underlying library. This class simply provides an interface to a specific implementation.


Member Typedef Documentation

template<typename T, typename I = int>
typedef BaseVectorInterface<T, I>::IdxType gridpack::math::VectorT< T, I >::IdxType

The size/index type used

Reimplemented from gridpack::math::BaseVectorInterface< T, I >.

template<typename T, typename I = int>
typedef BaseVectorInterface<T, I>::TheType gridpack::math::VectorT< T, I >::TheType

The numeric type used

Reimplemented from gridpack::math::BaseVectorInterface< T, I >.


Constructor & Destructor Documentation

template<typename T, typename I = int>
gridpack::math::VectorT< T, I >::VectorT ( const parallel::Communicator comm,
const int &  local_length 
)

Default constructor.

Collective.

A vector must be instantiated simulutaneously on all processes involved in the specified communicator. Each process in the communicator will own the number of elements requested.

Parameters:
comm parallel environment
local_length number of elements to be assigned to this process
Returns:
empty vector instance
template<typename T, typename I = int>
gridpack::math::VectorT< T, I >::VectorT ( ImplType *  vimpl  )  [explicit]

Constuct with an existing implementation.

This constructor is used to create a new vector instance using an existing VectorImplementation instance. This is needed by certain vector operations.

Parameters:
vimpl pointer to a new, allocated VectorImplementation instance
Returns:
new vector instance using the specified implementation

References gridpack::parallel::WrappedDistributed::WrappedDistributed().

template<typename T, typename I = int>
gridpack::math::VectorT< T, I >::~VectorT ( void   ) 

Destructor.

Collective.

A vector must be destroyed simulutaneously on all processes involved in the communicator used to instantiate it.


Member Function Documentation

template<typename T, typename I = int>
void gridpack::math::VectorT< T, I >::add ( const TheType x  ) 

Add the specified value to all elements.

Collective.

Parameters:
x 
template<typename T, typename I = int>
void gridpack::math::VectorT< T, I >::add ( const VectorT< T, I > &  x,
const TheType scale = 1.0 
)

Add the specified vector.

Collective.

Parameters:
x 
scale 
template<typename T, typename I = int>
VectorT* gridpack::math::VectorT< T, I >::clone ( void   )  const

Make an exact replica of this instance Collective.

Returns:

References gridpack::math::VectorT< T, I >::VectorT().

template<typename T, typename I = int>
void gridpack::math::VectorT< T, I >::elementDivide ( const VectorT< T, I > &  x  ) 

ELement-by-element divide by another Vector.

template<typename T, typename I = int>
void gridpack::math::VectorT< T, I >::elementMultiply ( const VectorT< T, I > &  x  ) 

Element-by-element multiply by another Vector.

template<typename T, typename I = int>
void gridpack::math::VectorT< T, I >::equate ( const VectorT< T, I > &  x  ) 

Copy the elements from the specified Vector.

Collective.

Parameters:
x 
template<typename T, typename I = int>
VectorT* gridpack::math::VectorT< T, I >::localClone ( void   )  const

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 3 Feb 2020 for GridPACK by  doxygen 1.6.1